home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH4 / 4-3-1.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-09-18  |  2.2 KB  |  75 lines

  1. VERSION 5.00
  2. Begin VB.Form frm4_3_1 
  3.    Caption         =   "Convert Fahrenheit to Celsius"
  4.    ClientHeight    =   1770
  5.    ClientLeft      =   1230
  6.    ClientTop       =   1695
  7.    ClientWidth     =   3840
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    LinkTopic       =   "Form1"
  18.    PaletteMode     =   1  'UseZOrder
  19.    ScaleHeight     =   1770
  20.    ScaleWidth      =   3840
  21.    Begin VB.PictureBox picTempC 
  22.       Height          =   255
  23.       Left            =   2640
  24.       ScaleHeight     =   195
  25.       ScaleWidth      =   915
  26.       TabIndex        =   4
  27.       Top             =   1320
  28.       Width           =   975
  29.    End
  30.    Begin VB.CommandButton cmdConvert 
  31.       Caption         =   "Convert to Celsius"
  32.       Default         =   -1  'True
  33.       Height          =   495
  34.       Left            =   240
  35.       TabIndex        =   2
  36.       Top             =   600
  37.       Width           =   3375
  38.    End
  39.    Begin VB.TextBox txtTempF 
  40.       Height          =   285
  41.       Left            =   2640
  42.       TabIndex        =   0
  43.       Top             =   240
  44.       Width           =   975
  45.    End
  46.    Begin VB.Label lblTempC 
  47.       Caption         =   "Temperature (Celsius)"
  48.       Height          =   255
  49.       Left            =   480
  50.       TabIndex        =   3
  51.       Top             =   1320
  52.       Width           =   1935
  53.    End
  54.    Begin VB.Label lblTempF 
  55.       Caption         =   "Temperature (Fahrenheit)"
  56.       Height          =   255
  57.       Left            =   240
  58.       TabIndex        =   1
  59.       Top             =   240
  60.       Width           =   2295
  61.    End
  62. Attribute VB_Name = "frm4_3_1"
  63. Attribute VB_GlobalNameSpace = False
  64. Attribute VB_Creatable = False
  65. Attribute VB_PredeclaredId = True
  66. Attribute VB_Exposed = False
  67. Private Sub cmdConvert_Click()
  68.   picTempC.Cls
  69.   picTempC.Print FtoC(Val(txtTempF.Text))
  70. End Sub
  71. Private Function FtoC(t As Single) As Single
  72.   'Convert Fahrenheit temperature to Celsius
  73.   FtoC = (5 / 9) * (t - 32)
  74. End Function
  75.